package DocketManage

import (
	"MedicalTreatment/global"
	model "MedicalTreatment/model"
	"github.com/gin-gonic/gin"
)

func UpdateDoc(r *gin.Engine) {
	r.POST("/updatedocket", func(context *gin.Context) {
		var udpDoc model.Docket
		if err := context.ShouldBindJSON(&udpDoc); err != nil {
			context.JSON(200, gin.H{
				"Msg": err,
			})
		} else {
			if err := global.DB.Where("id = ?", udpDoc.ID).Updates(&udpDoc).Error; err != nil {
				context.JSON(200, gin.H{
					"Msg": err,
				})
			} else {
				context.JSON(200, gin.H{
					"Msg": "修改成功",
				})
			}
		}
	})

}
